<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:t="http://myfaces.apache.org/tomahawk"
	xmlns:util="http://java.sun.com/jsf/composite/util">

<ui:composition>
	<h:panelGrid columns="2" cellpadding="4">

		<h:panelGroup>
			<rich:panel>
				<h:form>
						Wybierz autora książki i dodaj do listy:
						<h:selectOneMenu value="#{bookRegisterBean.select}">
						<f:selectItems value="#{bookRegisterBean.authors_list}" />
					</h:selectOneMenu>
					<br />
					<h:commandButton value="Dodaj"
						actionListener="#{bookRegisterBean.addAuthorToList}" />
					<h:messages />
				</h:form>
			</rich:panel>
			<rich:panel>
				<h:form>
						Dodaj nowego autora:
						<br />
					<util:formField
						beanProperty="#{bookRegisterBean.oneAuthor.author_first_name}"
						title="Imię" size="50" required="true" />
					<br />
					<util:formField
						beanProperty="#{bookRegisterBean.oneAuthor.author_last_name}"
						title="Nazwisko:" size="50" required="true" />
					<br />
					<h:commandButton value="Zapisz i Dodaj"
						actionListener="#{bookRegisterBean.saveAndAddAuthorToList}" />
				</h:form>
			</rich:panel>
		</h:panelGroup>
		<h:panelGroup>
			<h:selectManyListbox>
				<f:selectItems value="#{bookRegisterBean.menuItems}" />
			</h:selectManyListbox>
		</h:panelGroup>

	</h:panelGrid>
	<h:form>
		<rich:panel>
			<h:panelGrid columns="1">
				<util:formField beanProperty="#{bookRegisterBean.book.title}"
					title="Tytuł" size="106" required="true" />
				<h:panelGrid columns="2" cellpadding="4">
					<util:formField beanProperty="#{bookRegisterBean.book.isbn}"
						title="ISBN" size="48" required="true" />
					<util:formField beanProperty="#{bookRegisterBean.book.publisher}"
						title="Wydawnictwo" size="49" required="true" />
				</h:panelGrid>
				<br />
				<br />
				<h:panelGrid columns="3" cellpadding="4">
					<util:formField beanProperty="#{bookRegisterBean.book.pages}"
						title="Liczba stron" size="50" required="true" />
					<util:formField beanProperty="#{bookRegisterBean.book.issue_year}"
						title="Rok wydania" size="20" required="true" />
					<util:formField beanProperty="#{bookRegisterBean.book.price}"
						title="Cena" size="20" required="true" />
				</h:panelGrid>
				<h:panelGrid columns="2" cellpadding="4">
					<util:formField beanProperty="#{bookRegisterBean.book.section}"
						title="Dział" size="70" required="true" />
					<util:formField
						beanProperty="#{bookRegisterBean.book.number_of_books}"
						title="Liczba książek" size="27" required="true" />
				</h:panelGrid>
				<h:outputText value="Skrócony opis" styleClass="formOutputField" />
				<h:inputTextarea rows="3" cols="106"
					value="#{bookRegisterBean.book.short_descripton}" />
				<h:outputText value="Pełny opis" styleClass="formOutputField" />
				<h:inputTextarea rows="10" cols="106"
					value="#{bookRegisterBean.book.long_descripton}" />
				<br />
			</h:panelGrid>
			<rich:fileUpload maxFilesQuantity="1"
				fileUploadListener="#{bookRegisterBean.uploadFile}" />
			<t:div style="text-align:center;">
				<h:commandButton value="Zapisz"
					actionListener="#{bookRegisterBean.createBook}"
					action="#{jsfutils.redirect('mainContent/adminBooksManagementPage')}" />
				<h:commandButton value="Anuluj"
					actionListener="#{bookRegisterBean.cancelBookEdit}"
					action="#{jsfutils.redirect('mainContent/adminBooksManagementPage')}" />

			</t:div>
		</rich:panel>
	</h:form>
</ui:composition>
</html>
